//
//  ACEStudentDetailListTopView.m
//  ACE
//
//  Created by zhangtao on 2018/8/9.
//  Copyright © 2018年 zt.td. All rights reserved.
//

#import "ACEStudentDetailListTopView.h"

@implementation ACEStudentDetailListTopView

-(instancetype)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {
        self.layer.cornerRadius = 5;
        self.backgroundColor = [UIColor whiteColor];
        self.layer.shadowColor = lightGreen.CGColor;//shadowColor阴影颜色
        self.layer.shadowOffset = CGSizeMake(0,0);//shadowOffset阴影偏移,x向右偏移4，y向下偏移4，默认(0, -3)
        self.layer.shadowOpacity = 0.8;//阴影透明度，默认0
        self.layer.shadowRadius = 2;//阴影半径，默认3
        
        UIImageView *imageV = [[UIImageView alloc]initWithFrame:CGRectZero];
        [self addSubview:imageV];
        [imageV mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.mas_equalTo(self);
            make.centerX.mas_equalTo(self).mas_offset(@-45);
            make.width.mas_equalTo(@20);
            make.height.mas_equalTo(@20);
        }];
        imageV.image = [UIImage imageNamed:@"文件"];
        
        UIButton *btn = [[UIButton alloc]initWithFrame:CGRectZero];
        [self addSubview:btn];
        [btn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.mas_equalTo(self);
            make.left.mas_equalTo(imageV.mas_right).mas_offset(@10);
            make.height.mas_equalTo(@30);
            make.width.mas_equalTo(@70);
        }];
        btn.titleLabel.font = [UIFont systemFontOfSize:17];
        [btn setTitle:@"课程文件" forState:UIControlStateNormal];
        [btn setTitleColor:deepGreen forState:UIControlStateNormal];
        [btn addTarget:self action:@selector(click) forControlEvents:UIControlEventTouchUpInside];
    }
    return self;
}

-(void)click{
    if (self.studentDetailListTopClickCallBack) {
        self.studentDetailListTopClickCallBack();
    }
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
